using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
using System.Threading;
using Newtonsoft.Json.Serialization;
using ns16;
using ns20;

namespace Newtonsoft.Json
{
	public class JsonSerializer
	{
		internal TypeNameHandling typeNameHandling_0;

		internal FormatterAssemblyStyle formatterAssemblyStyle_0;

		internal PreserveReferencesHandling preserveReferencesHandling_0;

		internal ReferenceLoopHandling referenceLoopHandling_0;

		internal MissingMemberHandling missingMemberHandling_0;

		internal ObjectCreationHandling objectCreationHandling_0;

		internal NullValueHandling nullValueHandling_0;

		internal DefaultValueHandling defaultValueHandling_0;

		internal ConstructorHandling constructorHandling_0;

		internal JsonConverterCollection jsonConverterCollection_0;

		internal IContractResolver icontractResolver_0;

		internal ITraceWriter itraceWriter_0;

		internal SerializationBinder serializationBinder_0;

		internal StreamingContext streamingContext_0;

		private IReferenceResolver ireferenceResolver_0;

		private Formatting? nullable_0;

		private DateFormatHandling? nullable_1;

		private DateTimeZoneHandling? nullable_2;

		private DateParseHandling? nullable_3;

		private FloatFormatHandling? nullable_4;

		private FloatParseHandling? nullable_5;

		private StringEscapeHandling? nullable_6;

		private CultureInfo cultureInfo_0;

		private int? nullable_7;

		private bool bool_0;

		private bool? nullable_8;

		private string string_0;

		private bool bool_1;

		private EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs> eventHandler_0;

		public virtual IReferenceResolver IReferenceResolver_0
		{
			get
			{
				return method_1();
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value", "Reference resolver cannot be null.");
				}
				ireferenceResolver_0 = value;
			}
		}

		public virtual SerializationBinder SerializationBinder_0
		{
			get
			{
				return serializationBinder_0;
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value", "Serialization binder cannot be null.");
				}
				serializationBinder_0 = value;
			}
		}

		public virtual ITraceWriter ITraceWriter_0
		{
			get
			{
				return itraceWriter_0;
			}
			set
			{
				itraceWriter_0 = value;
			}
		}

		public virtual TypeNameHandling TypeNameHandling_0
		{
			get
			{
				return typeNameHandling_0;
			}
			set
			{
				if (value < TypeNameHandling.None || value > TypeNameHandling.Auto)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				typeNameHandling_0 = value;
			}
		}

		public virtual FormatterAssemblyStyle FormatterAssemblyStyle_0
		{
			get
			{
				return formatterAssemblyStyle_0;
			}
			set
			{
				if (value < FormatterAssemblyStyle.Simple || value > FormatterAssemblyStyle.Full)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				formatterAssemblyStyle_0 = value;
			}
		}

		public virtual PreserveReferencesHandling PreserveReferencesHandling_0
		{
			get
			{
				return preserveReferencesHandling_0;
			}
			set
			{
				if (value < PreserveReferencesHandling.None || value > PreserveReferencesHandling.All)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				preserveReferencesHandling_0 = value;
			}
		}

		public virtual ReferenceLoopHandling ReferenceLoopHandling_0
		{
			get
			{
				return referenceLoopHandling_0;
			}
			set
			{
				if (value < ReferenceLoopHandling.Error || value > ReferenceLoopHandling.Serialize)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				referenceLoopHandling_0 = value;
			}
		}

		public virtual MissingMemberHandling MissingMemberHandling_0
		{
			get
			{
				return missingMemberHandling_0;
			}
			set
			{
				if (value < MissingMemberHandling.Ignore || value > MissingMemberHandling.Error)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				missingMemberHandling_0 = value;
			}
		}

		public virtual NullValueHandling NullValueHandling_0
		{
			get
			{
				return nullValueHandling_0;
			}
			set
			{
				if (value < NullValueHandling.Include || value > NullValueHandling.Ignore)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				nullValueHandling_0 = value;
			}
		}

		public virtual DefaultValueHandling DefaultValueHandling_0
		{
			get
			{
				return defaultValueHandling_0;
			}
			set
			{
				if (value < DefaultValueHandling.Include || value > DefaultValueHandling.IgnoreAndPopulate)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				defaultValueHandling_0 = value;
			}
		}

		public virtual ObjectCreationHandling ObjectCreationHandling_0
		{
			get
			{
				return objectCreationHandling_0;
			}
			set
			{
				if (value < ObjectCreationHandling.Auto || value > ObjectCreationHandling.Replace)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				objectCreationHandling_0 = value;
			}
		}

		public virtual ConstructorHandling ConstructorHandling_0
		{
			get
			{
				return constructorHandling_0;
			}
			set
			{
				if (value < ConstructorHandling.Default || value > ConstructorHandling.AllowNonPublicDefaultConstructor)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				constructorHandling_0 = value;
			}
		}

		public virtual JsonConverterCollection JsonConverterCollection_0
		{
			get
			{
				if (jsonConverterCollection_0 == null)
				{
					jsonConverterCollection_0 = new JsonConverterCollection();
				}
				return jsonConverterCollection_0;
			}
		}

		public virtual IContractResolver IContractResolver_0
		{
			get
			{
				return icontractResolver_0;
			}
			set
			{
				icontractResolver_0 = value ?? DefaultContractResolver.IContractResolver_0;
			}
		}

		public virtual StreamingContext StreamingContext_0
		{
			get
			{
				return streamingContext_0;
			}
			set
			{
				streamingContext_0 = value;
			}
		}

		public virtual Formatting Formatting_0
		{
			get
			{
				return nullable_0 ?? Formatting.None;
			}
			set
			{
				nullable_0 = value;
			}
		}

		public virtual DateFormatHandling DateFormatHandling_0
		{
			get
			{
				return nullable_1 ?? DateFormatHandling.IsoDateFormat;
			}
			set
			{
				nullable_1 = value;
			}
		}

		public virtual DateTimeZoneHandling DateTimeZoneHandling_0
		{
			get
			{
				return nullable_2 ?? DateTimeZoneHandling.RoundtripKind;
			}
			set
			{
				nullable_2 = value;
			}
		}

		public virtual DateParseHandling DateParseHandling_0
		{
			get
			{
				return nullable_3 ?? DateParseHandling.DateTime;
			}
			set
			{
				nullable_3 = value;
			}
		}

		public virtual FloatParseHandling FloatParseHandling_0
		{
			get
			{
				return nullable_5 ?? FloatParseHandling.Double;
			}
			set
			{
				nullable_5 = value;
			}
		}

		public virtual FloatFormatHandling FloatFormatHandling_0
		{
			get
			{
				return nullable_4 ?? FloatFormatHandling.String;
			}
			set
			{
				nullable_4 = value;
			}
		}

		public virtual StringEscapeHandling StringEscapeHandling_0
		{
			get
			{
				return nullable_6 ?? StringEscapeHandling.Default;
			}
			set
			{
				nullable_6 = value;
			}
		}

		public virtual string String_0
		{
			get
			{
				return string_0 ?? "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";
			}
			set
			{
				string_0 = value;
				bool_1 = true;
			}
		}

		public virtual CultureInfo CultureInfo_0
		{
			get
			{
				return cultureInfo_0 ?? JsonSerializerSettings.cultureInfo_0;
			}
			set
			{
				cultureInfo_0 = value;
			}
		}

		public virtual int? Prop_0
		{
			get
			{
				return nullable_7;
			}
			set
			{
				if (value <= 0)
				{
					throw new ArgumentException("Value must be positive.", "value");
				}
				nullable_7 = value;
				bool_0 = true;
			}
		}

		public virtual bool Boolean_0
		{
			get
			{
				return nullable_8 ?? false;
			}
			set
			{
				nullable_8 = value;
			}
		}

		public virtual event EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs> Event_0
		{
			add
			{
				EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs> eventHandler = eventHandler_0;
				EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs> eventHandler2;
				do
				{
					eventHandler2 = eventHandler;
					EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs> value2 = (EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs>)Delegate.Combine(eventHandler2, value);
					eventHandler = Interlocked.CompareExchange(ref eventHandler_0, value2, eventHandler2);
				}
				while ((object)eventHandler != eventHandler2);
			}
			remove
			{
				EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs> eventHandler = eventHandler_0;
				EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs> eventHandler2;
				do
				{
					eventHandler2 = eventHandler;
					EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs> value2 = (EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs>)Delegate.Remove(eventHandler2, value);
					eventHandler = Interlocked.CompareExchange(ref eventHandler_0, value2, eventHandler2);
				}
				while ((object)eventHandler != eventHandler2);
			}
		}

		internal bool method_0()
		{
			return nullable_8.HasValue;
		}

		public JsonSerializer()
		{
			referenceLoopHandling_0 = ReferenceLoopHandling.Error;
			missingMemberHandling_0 = MissingMemberHandling.Ignore;
			nullValueHandling_0 = NullValueHandling.Include;
			defaultValueHandling_0 = DefaultValueHandling.Include;
			objectCreationHandling_0 = ObjectCreationHandling.Auto;
			preserveReferencesHandling_0 = PreserveReferencesHandling.None;
			constructorHandling_0 = ConstructorHandling.Default;
			typeNameHandling_0 = TypeNameHandling.None;
			streamingContext_0 = JsonSerializerSettings.streamingContext_0;
			serializationBinder_0 = DefaultSerializationBinder.defaultSerializationBinder_0;
			cultureInfo_0 = JsonSerializerSettings.cultureInfo_0;
			icontractResolver_0 = DefaultContractResolver.IContractResolver_0;
		}

		public static JsonSerializer Create()
		{
			return new JsonSerializer();
		}

		public static JsonSerializer Create(JsonSerializerSettings settings)
		{
			JsonSerializer jsonSerializer = Create();
			if (settings != null)
			{
				smethod_0(jsonSerializer, settings);
			}
			return jsonSerializer;
		}

		public static JsonSerializer CreateDefault()
		{
			JsonSerializerSettings settings = JsonConvert.DefaultSettings?.Invoke();
			return Create(settings);
		}

		public static JsonSerializer CreateDefault(JsonSerializerSettings settings)
		{
			JsonSerializer jsonSerializer = CreateDefault();
			if (settings != null)
			{
				smethod_0(jsonSerializer, settings);
			}
			return jsonSerializer;
		}

		private static void smethod_0(JsonSerializer jsonSerializer_0, JsonSerializerSettings jsonSerializerSettings_0)
		{
			if (!Class192.smethod_0(jsonSerializerSettings_0.Converters))
			{
				for (int i = 0; i < jsonSerializerSettings_0.Converters.Count; i++)
				{
					jsonSerializer_0.JsonConverterCollection_0.Insert(i, jsonSerializerSettings_0.Converters[i]);
				}
			}
			if (jsonSerializerSettings_0.nullable_18.HasValue)
			{
				jsonSerializer_0.TypeNameHandling_0 = jsonSerializerSettings_0.TypeNameHandling;
			}
			if (jsonSerializerSettings_0.nullable_9.HasValue)
			{
				jsonSerializer_0.FormatterAssemblyStyle_0 = jsonSerializerSettings_0.TypeNameAssemblyFormat;
			}
			if (jsonSerializerSettings_0.nullable_11.HasValue)
			{
				jsonSerializer_0.PreserveReferencesHandling_0 = jsonSerializerSettings_0.PreserveReferencesHandling;
			}
			if (jsonSerializerSettings_0.nullable_15.HasValue)
			{
				jsonSerializer_0.ReferenceLoopHandling_0 = jsonSerializerSettings_0.ReferenceLoopHandling;
			}
			if (jsonSerializerSettings_0.nullable_14.HasValue)
			{
				jsonSerializer_0.MissingMemberHandling_0 = jsonSerializerSettings_0.MissingMemberHandling;
			}
			if (jsonSerializerSettings_0.nullable_13.HasValue)
			{
				jsonSerializer_0.ObjectCreationHandling_0 = jsonSerializerSettings_0.ObjectCreationHandling;
			}
			if (jsonSerializerSettings_0.nullable_12.HasValue)
			{
				jsonSerializer_0.NullValueHandling_0 = jsonSerializerSettings_0.NullValueHandling;
			}
			if (jsonSerializerSettings_0.nullable_10.HasValue)
			{
				jsonSerializer_0.DefaultValueHandling_0 = jsonSerializerSettings_0.DefaultValueHandling;
			}
			if (jsonSerializerSettings_0.nullable_17.HasValue)
			{
				jsonSerializer_0.ConstructorHandling_0 = jsonSerializerSettings_0.ConstructorHandling;
			}
			if (jsonSerializerSettings_0.nullable_16.HasValue)
			{
				jsonSerializer_0.StreamingContext_0 = jsonSerializerSettings_0.Context;
			}
			if (jsonSerializerSettings_0.nullable_7.HasValue)
			{
				jsonSerializer_0.nullable_8 = jsonSerializerSettings_0.nullable_7;
			}
			if (jsonSerializerSettings_0.Error != null)
			{
				jsonSerializer_0.Event_0 += jsonSerializerSettings_0.Error;
			}
			if (jsonSerializerSettings_0.ContractResolver != null)
			{
				jsonSerializer_0.IContractResolver_0 = jsonSerializerSettings_0.ContractResolver;
			}
			if (jsonSerializerSettings_0.ReferenceResolver != null)
			{
				jsonSerializer_0.IReferenceResolver_0 = jsonSerializerSettings_0.ReferenceResolver;
			}
			if (jsonSerializerSettings_0.TraceWriter != null)
			{
				jsonSerializer_0.ITraceWriter_0 = jsonSerializerSettings_0.TraceWriter;
			}
			if (jsonSerializerSettings_0.Binder != null)
			{
				jsonSerializer_0.SerializationBinder_0 = jsonSerializerSettings_0.Binder;
			}
			if (jsonSerializerSettings_0.nullable_0.HasValue)
			{
				jsonSerializer_0.nullable_0 = jsonSerializerSettings_0.nullable_0;
			}
			if (jsonSerializerSettings_0.nullable_1.HasValue)
			{
				jsonSerializer_0.nullable_1 = jsonSerializerSettings_0.nullable_1;
			}
			if (jsonSerializerSettings_0.nullable_2.HasValue)
			{
				jsonSerializer_0.nullable_2 = jsonSerializerSettings_0.nullable_2;
			}
			if (jsonSerializerSettings_0.nullable_3.HasValue)
			{
				jsonSerializer_0.nullable_3 = jsonSerializerSettings_0.nullable_3;
			}
			if (jsonSerializerSettings_0.bool_2)
			{
				jsonSerializer_0.string_0 = jsonSerializerSettings_0.string_1;
				jsonSerializer_0.bool_1 = jsonSerializerSettings_0.bool_2;
			}
			if (jsonSerializerSettings_0.nullable_4.HasValue)
			{
				jsonSerializer_0.nullable_4 = jsonSerializerSettings_0.nullable_4;
			}
			if (jsonSerializerSettings_0.nullable_5.HasValue)
			{
				jsonSerializer_0.nullable_5 = jsonSerializerSettings_0.nullable_5;
			}
			if (jsonSerializerSettings_0.nullable_6.HasValue)
			{
				jsonSerializer_0.nullable_6 = jsonSerializerSettings_0.nullable_6;
			}
			if (jsonSerializerSettings_0.cultureInfo_1 != null)
			{
				jsonSerializer_0.cultureInfo_0 = jsonSerializerSettings_0.cultureInfo_1;
			}
			if (jsonSerializerSettings_0.bool_1)
			{
				jsonSerializer_0.nullable_7 = jsonSerializerSettings_0.nullable_8;
				jsonSerializer_0.bool_0 = jsonSerializerSettings_0.bool_1;
			}
		}

		public void Populate(TextReader reader, object target)
		{
			Populate(new JsonTextReader(reader), target);
		}

		public void Populate(JsonReader reader, object target)
		{
			Newtonsoft_002EJson_002EJsonSerializer_002E_200B_200E_200F_206C_206F_202D_200E_200F_200C_202A_202B_202A_202A_202D_206E_206F_200B_200B_200C_202D_202D_206A_200E_200B_202B_206C_206D_202D_206E_200C_206E_206C_206E_206F_206C_206F_200B_202A_202D_202A_202E(reader, target);
		}

		internal virtual void Newtonsoft_002EJson_002EJsonSerializer_002E_200B_200E_200F_206C_206F_202D_200E_200F_200C_202A_202B_202A_202A_202D_206E_206F_200B_200B_200C_202D_202D_206A_200E_200B_202B_206C_206D_202D_206E_200C_206E_206C_206E_206F_206C_206F_200B_202A_202D_202A_202E(JsonReader jsonReader_0, object object_0)
		{
			Class204.smethod_2(jsonReader_0, "reader");
			Class204.smethod_2(object_0, "target");
			Class137 @class = new Class137(this);
			@class.method_3(jsonReader_0, object_0);
		}

		public object Deserialize(JsonReader reader)
		{
			return Deserialize(reader, null);
		}

		public object Deserialize(TextReader reader, Type objectType)
		{
			return Deserialize(new JsonTextReader(reader), objectType);
		}

		public T Deserialize<T>(JsonReader reader)
		{
			return (T)Deserialize(reader, typeof(T));
		}

		public object Deserialize(JsonReader reader, Type objectType)
		{
			return Newtonsoft_002EJson_002EJsonSerializer_002E_206E_200E_206C_206D_206F_206D_206B_206F_202B_202B_202B_202E_202E_202C_206A_206D_202B_200E_200C_200D_202D_202C_200E_200B_202E_206C_206A_202A_200B_200D_206D_206A_200D_202C_200D_200D_200F_200B_206F_202E_202E(reader, objectType);
		}

		internal virtual object Newtonsoft_002EJson_002EJsonSerializer_002E_206E_200E_206C_206D_206F_206D_206B_206F_202B_202B_202B_202E_202E_202C_206A_206D_202B_200E_200C_200D_202D_202C_200E_200B_202E_206C_206A_202A_200B_200D_206D_206A_200D_202C_200D_200D_200F_200B_206F_202E_202E(JsonReader jsonReader_0, Type type_0)
		{
			Class204.smethod_2(jsonReader_0, "reader");
			CultureInfo cultureInfo = null;
			if (cultureInfo_0 != null && !cultureInfo_0.Equals(jsonReader_0.Culture))
			{
				cultureInfo = jsonReader_0.Culture;
				jsonReader_0.Culture = cultureInfo_0;
			}
			DateTimeZoneHandling? dateTimeZoneHandling = null;
			if (nullable_2.HasValue && jsonReader_0.DateTimeZoneHandling != nullable_2)
			{
				dateTimeZoneHandling = jsonReader_0.DateTimeZoneHandling;
				jsonReader_0.DateTimeZoneHandling = nullable_2.Value;
			}
			DateParseHandling? dateParseHandling = null;
			if (nullable_3.HasValue && jsonReader_0.DateParseHandling != nullable_3)
			{
				dateParseHandling = jsonReader_0.DateParseHandling;
				jsonReader_0.DateParseHandling = nullable_3.Value;
			}
			FloatParseHandling? floatParseHandling = null;
			if (nullable_5.HasValue && jsonReader_0.FloatParseHandling != nullable_5)
			{
				floatParseHandling = jsonReader_0.FloatParseHandling;
				jsonReader_0.FloatParseHandling = nullable_5.Value;
			}
			int? maxDepth = null;
			if (bool_0 && jsonReader_0.MaxDepth != nullable_7)
			{
				maxDepth = jsonReader_0.MaxDepth;
				jsonReader_0.MaxDepth = nullable_7;
			}
			Class69 @class = ((ITraceWriter_0 == null || ITraceWriter_0.LevelFilter < TraceLevel.Verbose) ? null : new Class69(jsonReader_0));
			Class137 class2 = new Class137(this);
			object result = class2.method_5(@class ?? jsonReader_0, type_0, Boolean_0);
			if (@class != null)
			{
				ITraceWriter_0.Trace(TraceLevel.Verbose, "Deserialized JSON: " + Environment.NewLine + @class.method_14(), null);
			}
			if (cultureInfo != null)
			{
				jsonReader_0.Culture = cultureInfo;
			}
			if (dateTimeZoneHandling.HasValue)
			{
				jsonReader_0.DateTimeZoneHandling = dateTimeZoneHandling.Value;
			}
			if (dateParseHandling.HasValue)
			{
				jsonReader_0.DateParseHandling = dateParseHandling.Value;
			}
			if (floatParseHandling.HasValue)
			{
				jsonReader_0.FloatParseHandling = floatParseHandling.Value;
			}
			if (bool_0)
			{
				jsonReader_0.MaxDepth = maxDepth;
			}
			return result;
		}

		public void Serialize(TextWriter textWriter, object value)
		{
			Serialize(new JsonTextWriter(textWriter), value);
		}

		public void Serialize(JsonWriter jsonWriter, object value, Type objectType)
		{
			Newtonsoft_002EJson_002EJsonSerializer_002E_200E_202E_206E_206B_200D_200D_200F_206A_200D_202C_202C_202D_202B_206D_200E_206C_206A_200F_200C_202A_202A_202B_202A_200C_206F_206A_200D_200F_200D_202A_200D_206F_202C_202D_200E_202B_206B_200D_206C_200C_202E(jsonWriter, value, objectType);
		}

		public void Serialize(TextWriter textWriter, object value, Type objectType)
		{
			Serialize(new JsonTextWriter(textWriter), value, objectType);
		}

		public void Serialize(JsonWriter jsonWriter, object value)
		{
			Newtonsoft_002EJson_002EJsonSerializer_002E_200E_202E_206E_206B_200D_200D_200F_206A_200D_202C_202C_202D_202B_206D_200E_206C_206A_200F_200C_202A_202A_202B_202A_200C_206F_206A_200D_200F_200D_202A_200D_206F_202C_202D_200E_202B_206B_200D_206C_200C_202E(jsonWriter, value, null);
		}

		internal virtual void Newtonsoft_002EJson_002EJsonSerializer_002E_200E_202E_206E_206B_200D_200D_200F_206A_200D_202C_202C_202D_202B_206D_200E_206C_206A_200F_200C_202A_202A_202B_202A_200C_206F_206A_200D_200F_200D_202A_200D_206F_202C_202D_200E_202B_206B_200D_206C_200C_202E(JsonWriter jsonWriter_0, object object_0, Type type_0)
		{
			Class204.smethod_2(jsonWriter_0, "jsonWriter");
			Formatting? formatting = null;
			if (nullable_0.HasValue && jsonWriter_0.Formatting != nullable_0)
			{
				formatting = jsonWriter_0.Formatting;
				jsonWriter_0.Formatting = nullable_0.Value;
			}
			DateFormatHandling? dateFormatHandling = null;
			if (nullable_1.HasValue && jsonWriter_0.DateFormatHandling != nullable_1)
			{
				dateFormatHandling = jsonWriter_0.DateFormatHandling;
				jsonWriter_0.DateFormatHandling = nullable_1.Value;
			}
			DateTimeZoneHandling? dateTimeZoneHandling = null;
			if (nullable_2.HasValue && jsonWriter_0.DateTimeZoneHandling != nullable_2)
			{
				dateTimeZoneHandling = jsonWriter_0.DateTimeZoneHandling;
				jsonWriter_0.DateTimeZoneHandling = nullable_2.Value;
			}
			FloatFormatHandling? floatFormatHandling = null;
			if (nullable_4.HasValue && jsonWriter_0.FloatFormatHandling != nullable_4)
			{
				floatFormatHandling = jsonWriter_0.FloatFormatHandling;
				jsonWriter_0.FloatFormatHandling = nullable_4.Value;
			}
			StringEscapeHandling? stringEscapeHandling = null;
			if (nullable_6.HasValue && jsonWriter_0.StringEscapeHandling != nullable_6)
			{
				stringEscapeHandling = jsonWriter_0.StringEscapeHandling;
				jsonWriter_0.StringEscapeHandling = nullable_6.Value;
			}
			CultureInfo cultureInfo = null;
			if (cultureInfo_0 != null && !cultureInfo_0.Equals(jsonWriter_0.Culture))
			{
				cultureInfo = jsonWriter_0.Culture;
				jsonWriter_0.Culture = cultureInfo_0;
			}
			string dateFormatString = null;
			if (bool_1 && jsonWriter_0.DateFormatString != string_0)
			{
				dateFormatString = jsonWriter_0.DateFormatString;
				jsonWriter_0.DateFormatString = string_0;
			}
			Class79 @class = ((ITraceWriter_0 == null || ITraceWriter_0.LevelFilter < TraceLevel.Verbose) ? null : new Class79(jsonWriter_0));
			Class138 class2 = new Class138(this);
			class2.method_3(@class ?? jsonWriter_0, object_0, type_0);
			if (@class != null)
			{
				ITraceWriter_0.Trace(TraceLevel.Verbose, "Serialized JSON: " + Environment.NewLine + @class.method_20(), null);
			}
			if (formatting.HasValue)
			{
				jsonWriter_0.Formatting = formatting.Value;
			}
			if (dateFormatHandling.HasValue)
			{
				jsonWriter_0.DateFormatHandling = dateFormatHandling.Value;
			}
			if (dateTimeZoneHandling.HasValue)
			{
				jsonWriter_0.DateTimeZoneHandling = dateTimeZoneHandling.Value;
			}
			if (floatFormatHandling.HasValue)
			{
				jsonWriter_0.FloatFormatHandling = floatFormatHandling.Value;
			}
			if (stringEscapeHandling.HasValue)
			{
				jsonWriter_0.StringEscapeHandling = stringEscapeHandling.Value;
			}
			if (bool_1)
			{
				jsonWriter_0.DateFormatString = dateFormatString;
			}
			if (cultureInfo != null)
			{
				jsonWriter_0.Culture = cultureInfo;
			}
		}

		internal IReferenceResolver method_1()
		{
			if (ireferenceResolver_0 == null)
			{
				ireferenceResolver_0 = new Class91();
			}
			return ireferenceResolver_0;
		}

		internal JsonConverter method_2(Type type_0)
		{
			return smethod_1(jsonConverterCollection_0, type_0);
		}

		internal static JsonConverter smethod_1(IList<JsonConverter> ilist_0, Type type_0)
		{
			if (ilist_0 != null)
			{
				for (int i = 0; i < ilist_0.Count; i++)
				{
					JsonConverter jsonConverter = ilist_0[i];
					if (jsonConverter.CanConvert(type_0))
					{
						return jsonConverter;
					}
				}
			}
			return null;
		}

		internal void method_3(Newtonsoft.Json.Serialization.ErrorEventArgs errorEventArgs_0)
		{
			eventHandler_0?.Invoke(this, errorEventArgs_0);
		}
	}
}
